home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS Toolkit
/
BBS Toolkit.iso
/
qbbs
/
useron21.zip
/
DOIT.PAS
next >
Wrap
Pascal/Delphi Source File
|
1991-02-23
|
3KB
|
114 lines
{-----------------------------------------------------------------------------|
DoIt 1.0
Gerhard Hoogterp (2:283/1.2 27:4331/106 HOOGTERPG@HENUT5.BITNET)
23 Feb 1991
Dumped in the Public domain, do with it whatever you like. Note however
that the usage of this unit is completely on your own risk!
Oh, don't make the DoString longer than 70 characters. UserOn.Exe will chop
|-----------------------------------------------------------------------------}
Unit DoIt;
Interface
Uses Dos;
Type DoString = String[70];
{------------------------------------------------------------------------|
Fill DoingWhat with the string you want to appear in the UserOn door
|------------------------------------------------------------------------}
Const DoingWhat : DoString = 'Working with a LiveSystems door.';
DefaultStr: DoString = 'In a door/external utility';
{------------------------------------------------------------------------|
GrabInfo Lookes for the USERDOES.<NodeNr> file and returns it's
contents when found. If not found the default string is returned.
|------------------------------------------------------------------------}
Function GrabInfo(LineNr : Byte):DoString;
{------------------------------------------------------------------------|
SetDoingInfo writes a file USERDOES.<NodeNr> with the DoingWhat string
|------------------------------------------------------------------------}
Procedure SetDoingInfo(LineNr : Byte);
{------------------------------------------------------------------------|
ClearDoingInfo erases the USERDOES.<NodeNr>
|------------------------------------------------------------------------}
Procedure ClearDoingInfo(LineNr : Byte);
Implementation
Type Str2 = String[2];
Var RAPath : ComStr;
Function S(Number : Byte;Size:Byte):Str2;
Var HStr : Str2;
Begin
Str(Number:Size,HStr);
S:=HStr;
End;
Procedure CompletePath(Var Path : String);
Begin
Path:=FExpand(Path);
If (Path[Length(Path)]<>'\') And
(Path[Length(Path)]<>':')
Then Path:=Path+'\';
End;
Function GrabInfo(LineNr : Byte):DoString;
Var DoIt : Text;
Line : DoString;
Begin
FileMode:=64; { ReadOnly/ShareDenyNone }
Assign(DoIt,RAPath+'UserDoes.'+S(LineNr,0));
Reset(DoIt);
If IoResult<>0
Then Begin
GrabInfo:=DefaultStr;
Exit;
End;
ReadLn(DoIt,Line);
Close(DoIt);
If Length(Line)>70
Then Line[0]:=#70;
GrabInfo:=Line;
End;
Procedure SetDoingInfo(LineNr : Byte);
Var DoIt : Text;
Begin
FileMode:=49; { WriteOnly/ShareDenyRead }
Assign(DoIt,RaPath+'UserDoes.'+S(LineNr,0));
Rewrite(DoIt);
WriteLn(DoIt,DoingWhat);
Close(DoIt);
End;
Procedure ClearDoingInfo(LineNr : Byte);
Var DoIt : File;
Begin
FileMode:=17; { WriteOnly/ShareDenyAll }
Assign(DoIt,RAPath+'UserDoes.'+S(LineNr,0));
Erase(DoIt);
End;
Begin
RAPath:=GetEnv('RA');
CompletePath(RAPath);
End.